class TicTacToeBoard:
   
    x_squares = 3
    y_squares = 3
    empty_square = '-'
    
    def __init__(self):
        # Creating an empty board
        self.theboard = self.__create() 

    def show(self):
        for row in self.theboard:
            print row

    def __create(self):
        return [ [self.empty_square] * self.x_squares for i in range(self.y_squares) ]

    def clear(self):
        self.theboard = self.__create() 

    def occupy_space(self, player_id, player_move):
        x_coord = player_move[0]
        y_coord = player_move[1]

        try:
            if self.theboard[x_coord][y_coord] == self.empty_square:
                self.theboard[x_coord][y_coord] = player_id
                return True
            else:
                return False
        except IndexError as e:
            return False

    def __run_test(self):
        print 
        print "####Testing Board####"
        print
        self.show()
        move = [1,1]
        if self.occupy_space(1, move):
            print "Move sucessesful"
        else:
            print "try again"
        self.show()
        move = [1,3]
        if self.occupy_space(0, move):
            print "Move sucessesful"
        else:
            print "try again"
        self.show()
        print
        self.clear()
        print
        self.show()


        
